home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 1
/
Atari Mega Archive - Volume 1.iso
/
gnu
/
othergnu
/
bc102s.zoo
/
readme.st
< prev
Wrap
Text File
|
1992-06-20
|
6KB
|
122 lines
bc 1.02 port 92/6/20
--------------------
This is a port of GNU bc 1.02 to atari ST. bc is an arbitrary precision
calculator language similar to C. bc can run interactively or can read
"batch" input from stdin or files. I compiled bc with GNU C v1.40 using the
MiNT libs at PL 19. There was only one change to the source to deal with:
the include of y.tab.h which bison generates as y_tab.h on the ST. It is
#ifdef atarist in scan.l. (The other #ifdefs in scan.c and bc.c were done
by bison and flex on their own. I used flex 2.3.7 and bison 1.14 from the
gnustuff directories on atari.archive.)
I also added carriage return in the lexical analyzer in the list of chars
to ignore in scan.l, i.e. from this:
[ \t]+ { /* ignore spaces and tabs */ }
to this:
[ \t\r]+ { /* ignore spaces and tabs (and carriage returns...)*/ }
Without this change, input files needed to to have lines terminated with
newline only (not cr-nl). Now bc will accept both. I tried changing this with
MiNT's `stty -crmod', UNIXMODE, etc. with no success, hence the change to the
scanner.
The makefile was altered a bit. It was generated by configure on a 4.3BSD/
POSIX system as was config.h. Changes were mainly in locations and in
peculiarities in my setup. Check it out before attempting a remake. Note
that the makefile seems somewhat flakey with dependencies. Executable
was compiled with `-O'. The executable was stripped with xstrip, removing
the symbol table and saving about 7k bytes of disk space, for the byte-hungry
lharc crowd. :-)
If present, the ./rcs directory contains changed files only. RCS rev 1.0 is
the rev of the original files.
You can probably ignore GNU C's warnings about incompatible pointer types
in scan.l (i.e., scan.c). This is because YY_CHAR is unsigned char and
util.c:strcopyof() accepts a signed char pointer. Same thing in this case
(since all strcopyof() does is malloc space and copy the string).
I ran some of the tests in ./test with appearent success. The libmath.b
file does not need to be installed since those math functions are already
builtin. To change this, compile with `-DBC_MATH_FILE=\"<filename>\"' added
to CFLAGS. This will cause bc to load <filename> if invoked with `-l'. As it
stands, you cannot redefine the functions that are provided, namely exp (e),
ln (l), sin (s), cos (c), atan (a), bessel (j) if invoking bc with `-l'. You
can, however, add to/replace the library by naming your own library on the
command line, as in (note the absence of `-l'):
bc mylib
The math.h file came with the distribution as-is. Note that I did build
fbc.ttp and generated math.h from scratch anyway, giving an identical file
as the distribution. The default scale is thus 20.
You can build an alternate math.h by using the existing executable:
bc -c mylib <u:/dev/null >math.h
You have to run the equivalent of fix_math.h (a shell script which invokes
ed(1)) before using math.h. All the script does is:
- add double quote (") as first char
- add backslash (\) to end of every line
- remove last line (the `@i' line)
- change trailing backslash on new last line to double quote.
This then gives a long string in C syntax which is included in global.c as
math.h. Then recompile global.c and relink. Remember that bc only allows
single char function names if you do this! Use libmath.b as a guide and RTFM.
The following files were generated:
what: how:
bc.c from bison'ing bc.y, then mv y_tab.c bc.c
y_tab.h from bison'ing bc.y (will get clobbered if you
make sbc.ttp or fbc.ttp)
scan.c from flex'ing scan.l, then mv lexyy.c scan.c
From what I can tell, fbc is only an intermediate form of bc, just so that
the math.h file can be generated. The `-c' flag means compile only.
The original tarfile contained these files (which were moved to the dist
directory after removing the .dist extension):
was: now:
./bc.c.dist ./dist/bc.c
./scan.c.dist ./dist/scan.c
./y.tab.h.dist ./dist/y_tab.h
I did not attempt to make sbc (which is supposed to be a POSIX-compliant
bc without the GNU extensions, mainly since GNU bc is supposed to run in
POSIX mode with the `-s' switch). Note that in order to gain access to the
predefined math functions in libmath.b, you must invoke bc with `-l'.
It seems to work both interactively and with stdin redirected. I was able
to suspend it from MiNT with a ^Z meaning it can sit in the background
forever if you want. Tested under MiNT 0.94 with tcsh 6.00.02 (jun92, ers).
Not tested under TOS alone (since I use MiNT/tcsh now exclusively). And
certainly not tested from the desktop! :-)
There may or may not be bugs beyond what the manpage sez. I did not test
it very well nor did I check to see if the ./test/*.b files gave accurate
results. It also should be possible to do dc(1) now, if anybody uses it.
Since I use a port of calc(1L) that was posted to comp.sources.unix ages
ago, I don't really need dc myself. And while I do have source to dc, I
can't post it because it is derived from AT&T source. Maybe the 4.3BSD
Taho release has a dc.
The manpage source was renamed bc.man (it was called bc.1) then it was
altered a bit and a manpager-ready nroff'ed manpage is in bc.1z (compressed,
generated with `nroff -man -T -rO1 ...' with a bit of hand editing). If you
don't use my manpager, you'll have to regenerate the catpage (bc.1) yourself.
Enjoy...
-Bill Rosenkranz
rosenkra@convex.com